<?php
require_once 'Authz/Database.php';

try {
    $config = dirname(__FILE__).'/config.php';
    if (!file_exists($config)) {
        die('Config me');
    }

    include $config;
    $cls = new VersionControl_SVN_Authz_Database;
    $cls->setDb(null, $db_user, $db_pass);
    $groups = $cls->getGroups();
    $perms  = $cls->getPermissions();

    require_once 'Authz.php';
    $content = VersionControl_SVN_Authz::generateAuthzFile($groups, $perms);
    file_put_contents($authzpath, $content);
} catch (VersionControl_SVN_Authz_Database_Exception $e) {
    echo "Message: {$e->getMessage()} (Code: {$e->getCode()}";
}